package org.example.backend.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.backend.domain.SysUser;
import org.example.backend.service.SysUserService;
import org.example.backend.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;


/**
 * @author 28254
 * @description 针对表【sys_user(用户表)】的数据库操作Service实现
 * @createDate 2024-10-07 18:51:18
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
        implements SysUserService {
    @Autowired
    private SysUserMapper sysUserMapper;
    @Autowired
    private PasswordEncoder bcrypt;

    //添加用户
    public void insertUser(SysUser sysUser) {
        String encode = bcrypt.encode(sysUser.getPassword());
        sysUser.setPassword(encode);
        sysUserMapper.insertUser(sysUser);
    }
}




